package com.xidian.edu.cn.search.controller;

import com.xidian.edu.cn.search.service.ElasticSearchService;
import com.xidian.edu.cn.search.vo.SearchParamVo;
import com.xidian.edu.cn.search.vo.SearchRespVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class SearchController {

    @Autowired
    private ElasticSearchService searchService;

    @GetMapping("/list.html")
    public String listPage(SearchParamVo searchParamVo, Model model){

        SearchRespVo respVo = searchService.search(searchParamVo);

        model.addAttribute("result", respVo);

        return "list";
    }
}
